package com.vrv.netmgr.entry;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;

import com.vrv.netmgr.R;

/**
 * @Description 启动画面
 * @author gaopei
 * @date
 */
public class SplashActivity extends Activity {
	//是否第一次使用
	private boolean isFirstUse;
	//定义共享文件
	private SharedPreferences sp;
	/**
	 * 启动画面停留的时间
	 */
	private final int SPLASH_DISPLAY_LENGHT = 2000;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.splash);
//		TextView txtTitle1 = (TextView)this.findViewById(R.id.title1);
//		TextView txtTitle2 = (TextView)this.findViewById(R.id.title2);

//		txtTitle1.getPaint().setFakeBoldText(true);
//		txtTitle2.getPaint().setFakeBoldText(true);
		//获取共享文件对象
		sp = getSharedPreferences("guideInfo", Context.MODE_PRIVATE);
		final SharedPreferences.Editor editor = sp.edit();
		//获取共享文件中的信息
		isFirstUse = sp.getBoolean("isFirstUse", true);
		new Handler().postDelayed(new Runnable() {
			public void run() {
				if(isFirstUse){
					editor.putBoolean("isFirstUse", false);
					editor.commit();
					startActivity(new Intent(SplashActivity.this, GuideActivity.class));
					overridePendingTransition(R.anim.push_left_in, R.anim.push_left_out);
				}else{
					startActivity(new Intent(SplashActivity.this, LoginActivity.class));
					overridePendingTransition(R.anim.push_up_in, R.anim.push_up_out);
				}
				SplashActivity.this.finish();
			}

		}, SPLASH_DISPLAY_LENGHT);
	}

}
